package com.ruoyi.system.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SysAppPrescriptioninfoMedicine;
import com.ruoyi.system.mapper.SysAppPrescriptioninfoMedicineMapper;
import com.ruoyi.system.service.ISysAppPrescriptioninfoMedicineService;

/**
 * 方剂与药物关联关系Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-10-11
 */
@Service
public class SysAppPrescriptioninfoMedicineServiceImpl implements ISysAppPrescriptioninfoMedicineService {
	@Autowired
	private SysAppPrescriptioninfoMedicineMapper sysAppPrescriptioninfoMedicineMapper;

	/**
	 * 查询方剂与药物关联关系
	 * 
	 * @param id 方剂与药物关联关系ID
	 * @return 方剂与药物关联关系
	 */
	@Override
	public SysAppPrescriptioninfoMedicine selectSysAppPrescriptioninfoMedicineById(Long id) {
		return sysAppPrescriptioninfoMedicineMapper.selectSysAppPrescriptioninfoMedicineById(id);
	}

	/**
	 * 查询方剂与药物关联关系列表
	 * 
	 * @param sysAppPrescriptioninfoMedicine 方剂与药物关联关系
	 * @return 方剂与药物关联关系
	 */
	@Override
	public List<SysAppPrescriptioninfoMedicine> selectSysAppPrescriptioninfoMedicineList(
			SysAppPrescriptioninfoMedicine sysAppPrescriptioninfoMedicine) {
		sysAppPrescriptioninfoMedicine.setPrescriptioninfoId(sysAppPrescriptioninfoMedicine.getId());
		return sysAppPrescriptioninfoMedicineMapper
				.selectSysAppPrescriptioninfoMedicineList(sysAppPrescriptioninfoMedicine);
	}

	@Override
	public List<SysAppPrescriptioninfoMedicine> selectMedicineList(
			SysAppPrescriptioninfoMedicine sysAppPrescriptioninfoMedicine) {
		return sysAppPrescriptioninfoMedicineMapper
				.selectSysAppPrescriptioninfoMedicineList(sysAppPrescriptioninfoMedicine);
	}

	/**
	 * 新增方剂与药物关联关系
	 * 
	 * @param sysAppPrescriptioninfoMedicine 方剂与药物关联关系
	 * @return 结果
	 */
	@Override
	public int insertSysAppPrescriptioninfoMedicine(SysAppPrescriptioninfoMedicine sysAppPrescriptioninfoMedicine) {
		sysAppPrescriptioninfoMedicine.setCreteTime(DateUtils.getNowDate());
		return sysAppPrescriptioninfoMedicineMapper
				.insertSysAppPrescriptioninfoMedicine(sysAppPrescriptioninfoMedicine);
	}

	/**
	 * 修改方剂与药物关联关系
	 * 
	 * @param sysAppPrescriptioninfoMedicine 方剂与药物关联关系
	 * @return 结果
	 */
	@Override
	public int updateSysAppPrescriptioninfoMedicine(SysAppPrescriptioninfoMedicine sysAppPrescriptioninfoMedicine) {
		return sysAppPrescriptioninfoMedicineMapper
				.updateSysAppPrescriptioninfoMedicine(sysAppPrescriptioninfoMedicine);
	}

	/**
	 * 删除方剂与药物关联关系对象
	 * 
	 * @param ids 需要删除的数据ID
	 * @return 结果
	 */
	@Override
	public int deleteSysAppPrescriptioninfoMedicineByIds(String ids) {
		return sysAppPrescriptioninfoMedicineMapper.deleteSysAppPrescriptioninfoMedicineByIds(Convert.toStrArray(ids));
	}

	/**
	 * 删除方剂与药物关联关系信息
	 * 
	 * @param id 方剂与药物关联关系ID
	 * @return 结果
	 */
	@Override
	public int deleteSysAppPrescriptioninfoMedicineById(Long id) {
		return sysAppPrescriptioninfoMedicineMapper.deleteSysAppPrescriptioninfoMedicineById(id);
	}
}
